package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.MannedB22h;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class MannedB22hConverter implements AttributeConverter<MannedB22h, String> {
    @Override
    public String convertToDatabaseColumn(MannedB22h mannedB22h) {
        return JSONUtil.toJsonStr(mannedB22h);
    }

    @Override
    public MannedB22h convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, MannedB22h.class);
    }
}
